home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.border;
-
- import java.awt.Component;
- import java.awt.Graphics;
- import java.awt.Insets;
-
- public class CompoundBorder extends AbstractBorder {
- protected Border outsideBorder;
- protected Border insideBorder;
-
- public CompoundBorder() {
- this.outsideBorder = null;
- this.insideBorder = null;
- }
-
- public CompoundBorder(Border outsideBorder, Border insideBorder) {
- this.outsideBorder = outsideBorder;
- this.insideBorder = insideBorder;
- }
-
- public Insets getBorderInsets(Component c) {
- int bottom = 0;
- int right = 0;
- int left = 0;
- int top = 0;
- if (this.outsideBorder != null) {
- Insets nextInsets = this.outsideBorder.getBorderInsets(c);
- top += nextInsets.top;
- left += nextInsets.left;
- right += nextInsets.right;
- bottom += nextInsets.bottom;
- }
-
- if (this.insideBorder != null) {
- Insets var7 = this.insideBorder.getBorderInsets(c);
- top += var7.top;
- left += var7.left;
- right += var7.right;
- bottom += var7.bottom;
- }
-
- return new Insets(top, left, bottom, right);
- }
-
- public Border getInsideBorder() {
- return this.insideBorder;
- }
-
- public Border getOutsideBorder() {
- return this.outsideBorder;
- }
-
- public boolean isBorderOpaque() {
- return this.outsideBorder != null && this.outsideBorder.isBorderOpaque() && this.insideBorder != null && this.insideBorder.isBorderOpaque();
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
- int px = x;
- int py = y;
- int pw = width;
- int ph = height;
- if (this.outsideBorder != null) {
- this.outsideBorder.paintBorder(c, g, x, y, width, height);
- Insets nextInsets = this.outsideBorder.getBorderInsets(c);
- px = x + nextInsets.left;
- py = y + nextInsets.top;
- pw = width - nextInsets.right - nextInsets.left;
- ph = height - nextInsets.bottom - nextInsets.top;
- }
-
- if (this.insideBorder != null) {
- this.insideBorder.paintBorder(c, g, px, py, pw, ph);
- }
-
- }
- }
-